
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <title>指标核心逻辑 · GitBook</title>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.0.0">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="explain-property1.html" />
    
    
    <link rel="prev" href="explain-intro.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    平台概念介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="plugin-intro.html">
            
                <a href="plugin-intro.html">
            
                    
                    指标开发简介
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="plugin-file.html">
            
                <a href="plugin-file.html">
            
                    
                    插件目录结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="plugin-conf.html">
            
                <a href="plugin-conf.html">
            
                    
                    插件配置文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="plugin-review.html">
            
                <a href="plugin-review.html">
            
                    
                    插件开发说明
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="explain-intro.html">
            
                <a href="explain-intro.html">
            
                    
                    指标开发讲解
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.3.1" data-path="explain-bootstrap.html">
            
                <a href="explain-bootstrap.html">
            
                    
                    指标核心逻辑
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="explain-property1.html">
            
                <a href="explain-property1.html">
            
                    
                    指标通用属性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="explain-property2.html">
            
                <a href="explain-property2.html">
            
                    
                    指标自定义属性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="explain-event.html">
            
                <a href="explain-event.html">
            
                    
                    指标钻取事件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="explain-summary.html">
            
                <a href="explain-summary.html">
            
                    
                    指标开发总结
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >指标核心逻辑</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x6307;&#x6807;&#x6838;&#x5FC3;&#x903B;&#x8F91;">&#x6307;&#x6807;&#x6838;&#x5FC3;&#x903B;&#x8F91;</h1>
<hr>
<p>&#x4EE5;simplelabel&#x4E3A;&#x4F8B;&#xFF0C;&#x4E0B;&#x9762;&#x8BB2;&#x89E3;&#x4E00;&#x4E0B;&#x5F00;&#x53D1;&#x6307;&#x6807;&#x903B;&#x8F91;&#x7684;&#x6CE8;&#x610F;&#x4E8B;&#x9879;&#xFF0C;&#x4E0B;&#x9762;&#x662F;&#x5176;&#x4EE3;&#x7801;&#x90E8;&#x5206;&#x3002;</p>
<pre><code>/**
 * Created by FreezeSoul on 2016/4/7.
 */
define([
    &quot;app/core/base&quot;,
    &quot;app/core/util&quot;,
    &quot;jquery&quot;,
    &quot;underscore&quot;,
    &apos;loglevel&apos;,
    &apos;jqueryTmpl&apos;,
    &apos;jQueryUUID&apos;
], function (Chart, Util, $, _, log) {

    var property = {
        config: &quot;property&quot;,
        option: [
            {
                group: &apos;&#x57FA;&#x7840;&apos;,
                id: &apos;LabelInitText&apos;,
                name: &apos;&#x521D;&#x59CB;&#x6587;&#x672C;&apos;,
                enable: false,
                type: &apos;text&apos;,
                value: &apos;&apos;,
                default: &apos;&apos;,
                link: &apos;text&apos;,
                tooltip: &apos;&#x6587;&#x672C;&#x6807;&#x7B7E;&#x521D;&#x59CB;&#x503C;&apos;
            },
            {
                group: &apos;&#x57FA;&#x7840;&apos;,
                id: &apos;LabelFontSize&apos;,
                name: &apos;&#x5B57;&#x4F53;&#x5927;&#x5C0F;&apos;,
                enable: false,
                type: &apos;number&apos;,
                value: 14,
                default: 14,
                link: &apos;fontSize&apos;,
                tooltip: &apos;&#x6587;&#x672C;&#x5B57;&#x4F53;&#x5927;&#x5C0F;&apos;
            },
            {
                group: &apos;&#x57FA;&#x7840;&apos;,
                id: &apos;LabelFontColor&apos;,
                name: &apos;&#x5B57;&#x4F53;&#x989C;&#x8272;&apos;,
                enable: false,
                type: &apos;color&apos;,
                value: &apos;#000000&apos;,
                default: &apos;#000000&apos;,
                link: &apos;fontColor&apos;,
                tooltip: &apos;&#x6587;&#x672C;&#x5B57;&#x4F53;&#x989C;&#x8272;&apos;
            },
            {
                group: &apos;&#x57FA;&#x7840;&apos;,
                id: &apos;LabelBorderPadding&apos;,
                name: &apos;&#x5185;&#x8FB9;&#x8DDD;&#x503C;&apos;,
                enable: false,
                type: &apos;padding&apos;,
                value: [5,5,5,5],
                default: [5,5,5,5],
                link: &apos;padding&apos;,
                tooltip: &apos;&#x6587;&#x672C;&#x5185;&#x8FB9;&#x8DDD;&#x503C;&apos;
            },
            {
                group: &apos;&#x57FA;&#x7840;&apos;,
                id: &apos;LabelBorderWidth&apos;,
                name: &apos;&#x8FB9;&#x6846;&#x5BBD;&#x5EA6;&apos;,
                enable: false,
                type: &apos;number&apos;,
                value: 1,
                default: 1,
                link: &apos;borderWidth&apos;,
                tooltip: &apos;&#x6587;&#x672C;&#x8FB9;&#x6846;&#x5BBD;&#x5EA6;&apos;
            },
            {
                group: &apos;&#x57FA;&#x7840;&apos;,
                id: &apos;LabelBorderStyle&apos;,
                name: &apos;&#x8FB9;&#x6846;&#x6837;&#x5F0F;&apos;,
                enable: false,
                type: &apos;select&apos;,
                value: &apos;solid&apos;,
                default: &apos;solid&apos;,
                data: [{
                    value: &apos;dotted&apos;,
                    text: &apos;&#x70B9;&#x7EBF;&#x8FB9;&#x6846;&apos;
                }, {
                    value: &apos;dashed&apos;,
                    text: &apos;&#x865A;&#x7EBF;&#x8FB9;&#x6846;&apos;
                }, {
                    value: &apos;solid&apos;,
                    text: &apos;&#x5B9E;&#x7EBF;&#x8FB9;&#x6846;&apos;
                }, {
                    value: &apos;double&apos;,
                    text: &apos;&#x4E24;&#x4E2A;&#x8FB9;&#x6846;&apos;
                }, {
                    value: &apos;groove&apos;,
                    text: &apos;3D&#x6C9F;&#x69FD;&#x8FB9;&#x6846;&apos;
                }, {
                    value: &apos;ridge&apos;,
                    text: &apos;3D&#x810A;&#x8FB9;&#x6846;&apos;
                }, {
                    value: &apos;inset&apos;,
                    text: &apos;3D&#x5D4C;&#x5165;&#x8FB9;&#x6846;&apos;
                }, {
                    value: &apos;outset&apos;,
                    text: &apos;3D&#x7A81;&#x51FA;&#x8FB9;&#x6846;&apos;
                }],
                link: &apos;fontStyle&apos;,
                tooltip: &apos;&#x6587;&#x672C;&#x8FB9;&#x6846;&#x6837;&#x5F0F;&apos;
            },
            {
                group: &apos;&#x57FA;&#x7840;&apos;,
                id: &apos;LabelBorderColor&apos;,
                name: &apos;&#x8FB9;&#x6846;&#x989C;&#x8272;&apos;,
                enable: false,
                type: &apos;color&apos;,
                value: &apos;#000000&apos;,
                default: &apos;#000000&apos;,
                link: &apos;borderColor&apos;,
                tooltip: &apos;&#x6587;&#x672C;&#x8FB9;&#x6846;&#x989C;&#x8272;&apos;
            },
            {
                group: &apos;&#x57FA;&#x7840;&apos;,
                id: &apos;LabelBackColor&apos;,
                name: &apos;&#x80CC;&#x666F;&#x989C;&#x8272;&apos;,
                enable: false,
                type: &apos;color&apos;,
                value: &apos;transparent&apos;,
                default: &apos;transparent&apos;,
                link: &apos;backColor&apos;,
                tooltip: &apos;&#x6587;&#x672C;&#x80CC;&#x666F;&#x989C;&#x8272;&#xFF0C;&#x900F;&#x660E;&#x8272;transparent&apos;
            },
            {
                group: &apos;&#x57FA;&#x7840;&apos;,
                id: &apos;LabelBangDing&apos;,
                name: &apos;&#x7ED1;&#x5B9A;&#x6587;&#x672C;&apos;,
                enable: false,
                type: &apos;textBinding&apos;,
                dataset: &apos;&apos;,
                ctype: &apos;all&apos;,
                column: {},
                tooltip: &apos;&#x6587;&#x672C;&#x7ED1;&#x5B9A;&apos;
            }
        ],
        MapOption: function (option) {
            Util.linkOption(this.option, option);
        }
    };

    var label = Chart.extend({
        constructor: function (layout) {
            this._layout = layout;
            this._element = null;
            this._container = null;
            this._option = {
                Series: [],
                Events: [],
                Extend: $.extend(true, {}, property),
                Option: {
                    text: &quot;&#x6807;&#x7B7E;&#x63A7;&#x4EF6;&quot;,
                    padding: [5, 5, 5, 5],
                    fontSize: 14,
                    fontColor: &quot;#000000&quot;,
                    fontStyle: &quot;&quot;,
                    borderWidth: 1,
                    borderColor: &quot;#000000&quot;,
                    backColor: &quot;transparent&quot;
                }
            };
        },
        init: function (element) {
            try {
                this._uuid = $.uuid();
                this._container = element;
            } catch (e) {
                log.error(e);
            }
        },
        _readProperty: function () {
            try {
                if (!this._option.Extend) return;
                Util.deepMapOption(property, this._option.Extend, this._option.Option);
            } catch (e) {
                log.error(e);
            }
        },
        _render: function (option) {
            var $element = $.tmpl(&apos;&lt;span id=&quot;${id}&quot; class=&quot;label-text&quot;&gt;${text}&lt;/span&gt;&apos;, $.extend(true, {
                id: this._uuid
            }, option));
            if (option.fontSize &amp;&amp; option.fontSize &gt; 0) {
                $element.css(&quot;font-size&quot;, option.fontSize + &quot;px&quot;)
            }
            if ($.isArray(option.padding) &amp;&amp; option.padding.length == 4) {
                if (option.padding[0] &amp;&amp; option.padding[0] &gt; 0)
                    $element.css(&quot;padding-top&quot;, option.padding[0]);
                if (option.padding[1] &amp;&amp; option.padding[1] &gt; 0)
                    $element.css(&quot;padding-right&quot;, option.padding[1]);
                if (option.padding[2] &amp;&amp; option.padding[2] &gt; 0)
                    $element.css(&quot;padding-bottom&quot;, option.padding[2]);
                if (option.padding[3] &amp;&amp; option.padding[3] &gt; 0)
                    $element.css(&quot;padding-left&quot;, option.padding[3]);
            }
            if (option.fontColor) {
                $element.css(&quot;color&quot;, option.fontColor)
            }
            if (option.borderWidth &amp;&amp; option.borderWidth &gt; 0) {
                $element.css(&quot;border-width&quot;, option.borderWidth + &quot;px&quot;)
            }
            if (option.borderColor) {
                $element.css(&quot;border-color&quot;, option.borderColor)
            }
            if (option.fontStyle) {
                $element.css(&quot;border-style&quot;, option.fontStyle)
            }
            if (option.backColor) {
                $element.css(&quot;background-color&quot;, option.backColor)
            }
            $element.css(&quot;display&quot;, &quot;inline-block&quot;);
            $(this._container).empty();
            $element.appendTo(this._container);
            this._bindEvent($element);
            return $element;
        },
        _bindEvent: function (element) {
            var _this = this;
            $(element).on(&quot;click&quot;, function (e) {
                if (_this._layout
                    &amp;&amp; _this._layout.navigate
                    &amp;&amp; _this._option.Events
                    &amp;&amp; _this._option.Events.length &gt; 0) {

                    var registerEvent = _.findWhere(_this._option.Events, {Event: &quot;LabelClick&quot;});
                    if (registerEvent) {
                        var pageId = registerEvent.PageId;
                        var params = registerEvent.Params;
                        var args = [];
                        var dParam = _.findWhere(params, {Name: &quot;&#x6587;&#x672C;&quot;});
                        if (dParam &amp;&amp; dParam.ParamName) {
                            args.push({
                                ParamName: dParam.ParamName,
                                ParamValue: $(element).find(&quot;.label-text&quot;).text()
                            });
                        }
                        _this._layout.navigate(pageId, args);
                    }
                    e.preventDefault();
                }
            });
        },
        example: function () {
            try {
                this._element = this._render(this._option.Option);
            } catch (e) {
                log.error(e);
            }
        },
        _bindData: function (data) {
            var bindProperty = _.findWhere(this._option.Extend.option, {type: &apos;textBinding&apos;});
            if (!bindProperty || !bindProperty.dataset) return;
            var dataSetCode = bindProperty.dataset;
            var table = data[dataSetCode];
            if (table &amp;&amp; table.length &gt; 0 &amp;&amp; bindProperty.column) {
                var row = table[0];
                var columnName = bindProperty.column.ColumnName;
                if (columnName) {
                    this._option.Option.text = row[columnName];
                }
            }
        },
        setData: function (data) {
            try {
                this._readProperty();
                if (data
                    &amp;&amp; this._option.Binding
                    &amp;&amp; this._option.Binding.length &gt; 0
                    &amp;&amp; this._option.Extend
                ) {
                    this._bindData(data);
                }
                this._element = this._render(this._option.Option);
            } catch (e) {
                log.error(e);
            }
        },
        setOption: function (option) {
            try {
                this._option = $.extend(true, {}, option);
            } catch (e) {
                log.error(e);
            }
        },
        getOption: function () {
            try {
                this._readProperty();
            } catch (e) {
                log.error(e);
            }
            return this._option;
        },
        setTheme: function (theme) {
            try {
            } catch (e) {
                log.error(e);
            }
        },
        resize: function () {
            try {
            } catch (e) {
                log.error(e);
            }
        },
        showLoading: function () {
            try {
                if (this._layout &amp;&amp; this._layout.showLoading) {
                    this._layout.showLoading(this);
                }
            } catch (e) {
                log.error(e);
            }
        },
        hideLoading: function () {
            try {
                if (this._layout &amp;&amp; this._layout.hideLoading) {
                    this._layout.hideLoading(this);
                }
            } catch (e) {
                log.error(e);
            }
        },
        dispose: function () {
            try {
            } catch (e) {
                log.error(e);
            }
        },
        getElement: function () {
            return this._element;
        }
        getChart: function () {
            return this._element;
        }
    });

    return {
        Chart: label,
        Property: property
    };
});
</code></pre><p>&#x6574;&#x4F53;&#x4EE3;&#x7801;&#x98CE;&#x683C;&#x91C7;&#x7528;&#x4E86;AMD&#x65B9;&#x5F0F;&#x505A;&#x4E86;&#x5305;&#x88C5;&#xFF0C;&#x6B64;&#x793A;&#x4F8B;&#x4E2D;&#x91C7;&#x7528;&#x4E86;&#x901A;&#x7528;&#x5C5E;&#x6027;&#x8BBE;&#x8BA1;&#x5668;&#x7684;&#x652F;&#x6301;&#xFF0C;&#x6240;&#x4EE5;&#x8FD4;&#x56DE;&#x7C7B;&#x578B;&#x5305;&#x542B;<code>Property</code>&#xFF08;&#x901A;&#x7528;&#x5C5E;&#x6027;&#x90E8;&#x5206;&#x8BE6;&#x89E3;&#x8BF7;&#x53C2;&#x89C1; <strong>&#x6307;&#x6807;&#x901A;&#x7528;&#x5C5E;&#x6027;</strong> &#x7AE0;&#x8282;&#xFF09;</p>
<p>&#x4E0B;&#x9762;&#x9488;&#x5BF9;&#x5B9E;&#x73B0;&#x65B9;&#x6CD5;&#x91CD;&#x70B9;&#x8BB2;&#x89E3;&#xFF1A;</p>
<ul>
<li>&#x6240;&#x6709;&#x6307;&#x6807;&#x63D2;&#x4EF6;&#x7684;&#x5B9E;&#x73B0;&#x90FD;&#x8981;&#x6C42;&#x91C7;&#x7528;<code>Chart.extend</code>&#x65B9;&#x5F0F;&#x7EE7;&#x627F;&#x5E73;&#x53F0;&#x63A5;&#x53E3;&#xFF0C;&#x5176;<strong>Chart</strong>&#x662F;&#x901A;&#x8FC7;define&#x5F15;&#x7528;&#x7684;<code>&quot;app/core/base&quot;</code>&#x811A;&#x672C;&#x5B9E;&#x4F8B;&#x3002;</li>
<li>&#x63A5;&#x53E3;&#x65B9;&#x6CD5;<code>constructor</code>&#x662F;&#x6784;&#x9020;&#x6307;&#x6807;&#x63D2;&#x4EF6;&#x7684;&#x5B9E;&#x4F8B;&#x7684;&#x8C03;&#x7528;&#x65B9;&#x6CD5;&#xFF0C;&#x901A;&#x5E38;&#x653E;&#x7F6E;&#x4E00;&#x4E9B;&#x4E0E;&#x6570;&#x636E;&#x65E0;&#x5173;&#x7684;&#x7C7B;&#x578B;&#x5B9A;&#x4E49;&#x7B49;&#x64CD;&#x4F5C;&#x3002;&#x65B9;&#x6CD5;&#x53C2;&#x6570;&#x4F20;&#x5165;&#x9875;&#x9762;&#x5E03;&#x5C40;&#x5B9E;&#x4F8B;&#x5BF9;&#x8C61;&#x3002;</li>
<li>&#x63A5;&#x53E3;&#x65B9;&#x6CD5;<code>init</code>&#x662F;&#x521D;&#x59CB;&#x5316;&#x6307;&#x6807;&#x63D2;&#x4EF6;&#x7684;&#x8C03;&#x7528;&#x65B9;&#x6CD5;&#xFF0C;&#x5728;&#x8FD9;&#x91CC;&#x4E00;&#x822C;&#x4F1A;&#x505A;&#x6307;&#x6807;&#x63D2;&#x4EF6;&#x7684;&#x521D;&#x59CB;&#x5316;&#x64CD;&#x4F5C;&#x3002;&#x65B9;&#x6CD5;&#x53C2;&#x6570;&#x4F20;&#x5165;&#x4E00;&#x4E2A;dom&#x5143;&#x7D20;&#xFF0C;&#x662F;&#x7528;&#x6765;&#x88C5;&#x8F7D;&#x6307;&#x6807;&#x63D2;&#x4EF6;&#x7684;HMTL element&#x5143;&#x7D20;&#x3002;&#x65B9;&#x6CD5;&#x652F;&#x6301;&#x8FD4;&#x56DE; <strong>JavaScript Promises</strong> &#x5BF9;&#x8C61;&#xFF0C;&#x53EF;&#x4EE5;&#x5C06;&#x4E00;&#x4E9B;&#x5F02;&#x6B65;&#x521D;&#x59CB;&#x5316;&#x64CD;&#x4F5C;&#x653E;&#x7F6E;&#x4E8E;&#x6B64;&#xFF08;&#x5982;AMD&#x5F02;&#x6B65;&#x8D44;&#x6E90;&#x52A0;&#x8F7D;&#x3001;Ajax&#x670D;&#x52A1;&#x8BF7;&#x6C42;&#x4EE3;&#x7801;&#x7B49;&#xFF09;&#xFF0C;&#x5177;&#x4F53;&#x53EF;&#x53C2;&#x89C1;&#x5982;&#x4E0B;&#xFF1A;</li>
</ul>
<p>&#x540C;&#x6B65;&#x521D;&#x59CB;&#x5316;&#x65B9;&#x5F0F;&#xFF1A;</p>
<pre><code>init: function (element) {
    try {
        this._uuid = $.uuid();
        this._container = element;
    } catch (e) {
        log.error(e);
    }
}</code></pre>

<p>&#x5F02;&#x6B65;&#x521D;&#x59CB;&#x5316;&#x65B9;&#x5F0F;&#xFF1A;</p>
<pre><code>init: function (element) {
    try {
        var _this = this;
        var deferred = $.Deferred();
        require([FindMapJsFile(this._option.Option.mapType)], function () {
            _this._chart = ec.init(element, null, {
                renderer: &apos;canvas&apos;
            });
            _this._bindEvent();
            deferred.resolve(_this._chart);
        });
        return deferred.promise();
    } catch (e) {
            log.error(e);
    }
}</code></pre>

<ul>
<li>&#x63A5;&#x53E3;&#x65B9;&#x6CD5;<code>example</code>&#x662F;&#x8BBE;&#x8BA1;&#x5668;&#x8C03;&#x7528;&#x52A0;&#x8F7D;&#x793A;&#x4F8B;&#x6570;&#x636E;&#x7684;&#x65B9;&#x6CD5;&#xFF0C;&#x5728;&#x65B9;&#x6CD5;&#x91CC;&#x9700;&#x8981;&#x51C6;&#x5907;&#x4E00;&#x7EC4;&#x793A;&#x4F8B;&#x6570;&#x636E;&#x521D;&#x59CB;&#x5316;&#x6307;&#x6807;&#x63D2;&#x4EF6;&#x3002;</li>
<li><p>&#x63A5;&#x53E3;&#x65B9;&#x6CD5;<code>setData</code>&#x662F;&#x6307;&#x6807;&#x63D2;&#x4EF6;&#x7ED1;&#x5B9A;&#x6570;&#x636E;&#x96C6;&#x540E;&#xFF0C;&#x6570;&#x636E;&#x96C6;&#x586B;&#x5145;&#x6307;&#x6807;&#x6240;&#x9700;&#x8C03;&#x7528;&#x7684;&#x65B9;&#x6CD5;&#xFF0C;&#x4F20;&#x5165;&#x53C2;&#x6570;&#x4E3A;&#x6570;&#x636E;json&#x5BF9;&#x8C61;&#x3002;</p>
<pre><code>{
  &quot;yuetongji&quot;: [
      {
          &quot;value&quot;: 312, 
          &quot;month&quot;: &quot;&#x4E00;&#x6708;&quot;
      }, 
      {
          &quot;value&quot;: 142, 
          &quot;month&quot;: &quot;&#x4E8C;&#x6708;&quot;
      }, 
      {
          &quot;value&quot;: 412, 
          &quot;month&quot;: &quot;&#x4E09;&#x6708;&quot;
      }, 
      {
          &quot;value&quot;: 421, 
          &quot;month&quot;: &quot;&#x56DB;&#x6708;&quot;
      }, 
      {
          &quot;value&quot;: 234, 
          &quot;month&quot;: &quot;&#x4E94;&#x6708;&quot;
      }, 
      {
          &quot;value&quot;: 785, 
          &quot;month&quot;: &quot;&#x516D;&#x6708;&quot;
      }, 
      {
          &quot;value&quot;: 249, 
          &quot;month&quot;: &quot;&#x4E03;&#x6708;&quot;
      }, 
      {
          &quot;value&quot;: 675, 
          &quot;month&quot;: &quot;&#x516B;&#x6708;&quot;
      }, 
      {
          &quot;value&quot;: 689, 
          &quot;month&quot;: &quot;&#x4E5D;&#x6708;&quot;
      }, 
      {
          &quot;value&quot;: 642, 
          &quot;month&quot;: &quot;&#x5341;&#x6708;&quot;
      }, 
      {
          &quot;value&quot;: 423, 
          &quot;month&quot;: &quot;&#x5341;&#x4E00;&#x6708;&quot;
      }, 
      {
          &quot;value&quot;: 753, 
          &quot;month&quot;: &quot;&#x5341;&#x4E8C;&#x6708;&quot;
      }
  ]
}</code></pre>
</li>
<li><p>&#x63A5;&#x53E3;&#x65B9;&#x6CD5;<code>setOption</code>&#x4E0E;<code>getOption</code>&#x662F;&#x5E73;&#x53F0;&#x8BBE;&#x8BA1;&#x5668;&#x5728;&#x6307;&#x6807;&#x7F16;&#x8F91;&#x65F6;&#x8BBE;&#x7F6E;&#x4E0E;&#x83B7;&#x53D6;&#x6307;&#x6807;&#x8BBE;&#x7F6E;&#x53C2;&#x6570;&#x7684;&#x65B9;&#x6CD5;&#x3002;</p>
<pre><code>{
  &quot;Binding&quot;: [ ], 
  &quot;Events&quot;: [ ], 
  &quot;Extend&quot;: { }, 
  &quot;Option&quot;: { }
}</code></pre>

</li>
</ul>
<p>&#x5176;&#x4E2D;&#x6307;&#x6807;&#x53C2;&#x6570;&#x4E2D;<code>Binding</code>&#x4E3A;&#x7ED1;&#x5B9A;&#x5BF9;&#x8C61;&#xFF0C;&#x63CF;&#x8FF0;&#x4E86;&#x7ED1;&#x5B9A;&#x6570;&#x636E;&#x96C6;&#x7684;&#x7ED3;&#x6784;&#x4E0E;&#x4FE1;&#x606F;&#xFF0C;&#x4E00;&#x822C;&#x7528;&#x4E8E;<code>setData</code>&#x64CD;&#x4F5C;&#x4E2D;&#xFF0C;&#x793A;&#x4F8B;&#x7ED3;&#x6784;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code>&quot;Binding&quot;: [
    {
        &quot;Name&quot;: &quot;&#x6708;&#x7EDF;&#x8BA1;&#x5206;&#x6790;&quot;, 
        &quot;Dimensions&quot;: [
            {
                &quot;Code&quot;: &quot;&#x6708;&#x4EFD;&quot;, 
                &quot;Name&quot;: &quot;&#x6708;&#x4EFD;&quot;, 
                &quot;DataType&quot;: &quot;string&quot;, 
                &quot;AnalysisType&quot;: &quot;dimension&quot;, 
                &quot;Column&quot;: &quot;month&quot;
            }
        ], 
        &quot;Measures&quot;: [
            {
                &quot;Code&quot;: &quot;&#x6570;&#x503C;&quot;, 
                &quot;Name&quot;: &quot;2012&#x5E74;&quot;, 
                &quot;DataType&quot;: &quot;int&quot;, 
                &quot;AnalysisType&quot;: &quot;measure&quot;, 
                &quot;Column&quot;: &quot;value&quot;
            }
        ], 
        &quot;DataSetCode&quot;: &quot;yuetongji&quot;, 
        &quot;PushFrequency&quot;: 0
    }
]</code></pre>

<p>&#x6307;&#x6807;&#x53C2;&#x6570;&#x7684;<code>Events</code>&#x4E3A;&#x4E8B;&#x4EF6;&#x5BF9;&#x8C61;&#xFF0C;&#x63CF;&#x8FF0;&#x4E86;&#x6307;&#x6807;&#x4E8B;&#x4EF6;&#x53D1;&#x751F;&#x7684;&#x53C2;&#x6570;&#x4FE1;&#x606F;&#xFF0C;&#x4E00;&#x822C;&#x7528;&#x4E8E;&#x6307;&#x6807;&#x53C2;&#x6570;&#x7684;&#x4E8B;&#x4EF6;&#x5904;&#x7406;&#x903B;&#x8F91;&#x4E2D;&#xFF0C;<code>ParamName</code>&#x5BF9;&#x5E94;&#x6570;&#x636E;&#x96C6;&#x5B9A;&#x4E49;&#x7684;&#x53C2;&#x6570;&#xFF0C;&#x5B9E;&#x4F8B;&#x7ED3;&#x6784;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code>&quot;Events&quot;: [
    {
        &quot;Event&quot;: &quot;SeriesClick&quot;, 
        &quot;Params&quot;: [
            {
                &quot;ParamName&quot;:&quot;#&#x5E8F;&#x5217;&#x540D;&#x79F0;#&quot;,
                &quot;Value&quot;: &quot;SeriesName&quot;, 
                &quot;Name&quot;: &quot;&#x5E8F;&#x5217;&#x540D;&#x79F0;&quot;
            }, 
            {
                &quot;ParamName&quot;:&quot;#&#x5E8F;&#x5217;&#x7EF4;&#x5EA6;&#x503C;#&quot;,
                &quot;Value&quot;: &quot;Dimension&quot;, 
                &quot;Name&quot;: &quot;&#x5E8F;&#x5217;&#x7EF4;&#x5EA6;&#x503C;&quot;
            }, 
            {
                &quot;ParamName&quot;:&quot;#&#x5E8F;&#x5217;&#x5EA6;&#x91CF;&#x503C;#&quot;,
                &quot;Value&quot;: &quot;Measure&quot;, 
                &quot;Name&quot;: &quot;&#x5E8F;&#x5217;&#x5EA6;&#x91CF;&#x503C;&quot;
            }
        ], 
        &quot;PageId&quot;: 18
    }
]</code></pre>

<p>&#x6307;&#x6807;&#x53C2;&#x6570;&#x7684;<code>Extend</code>&#x4E3A;&#x6269;&#x5C55;&#x6570;&#x636E;&#xFF0C;&#x4E00;&#x822C;&#x7528;&#x4E8E;&#x5B58;&#x50A8;&#x901A;&#x7528;&#x5C5E;&#x6027;&#x8BBE;&#x8BA1;&#x5668;&#x7684;&#x8BBE;&#x7F6E;&#x4FE1;&#x606F;&#xFF0C;&#x4F46;&#x4E0D;&#x5F3A;&#x5236;&#xFF0C;&#x53EF;&#x53C2;&#x89C1;&#x4E0A;&#x9762;&#x7684;&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#x5904;&#x7406;&#x65B9;&#x5F0F;&#x3002;</p>
<p>&#x6307;&#x6807;&#x53C2;&#x6570;&#x7684;<code>Option</code>&#x4E3A;&#x53C2;&#x6570;&#x6570;&#x636E;&#xFF0C;&#x4E00;&#x822C;&#x7528;&#x4E8E;&#x5B58;&#x50A8;&#x6307;&#x6807;&#x7684;&#x914D;&#x7F6E;&#x53C2;&#x6570;&#x4FE1;&#x606F;&#xFF0C;&#x5728;&#x6307;&#x6807;&#x8BBE;&#x8BA1;&#x6A21;&#x5F0F;&#x4E0B;&#x7684;&#x4EE3;&#x7801;&#x6A21;&#x5F0F;&#x6240;&#x52A0;&#x8F7D;&#x7684;&#x5185;&#x5BB9;&#x3002;</p>
<p><img src="images/edit-code.png" alt="EditorCode" title="&#x4EE3;&#x7801;&#x6A21;&#x5F0F;"></p>
<ul>
<li>&#x63A5;&#x53E3;&#x65B9;&#x6CD5;<code>resize</code>&#x5728;&#x7A97;&#x4F53;&#x4E0E;&#x5BB9;&#x5668;&#x53D8;&#x5316;&#x65F6;&#x8C03;&#x7528;&#xFF0C;&#x9700;&#x5B9E;&#x73B0;&#x6307;&#x6807;&#x63D2;&#x4EF6;&#x7684;&#x91CD;&#x7ED8;&#x3002;</li>
<li>&#x63A5;&#x53E3;&#x65B9;&#x6CD5;<code>showLoading</code>&#x4E0E;<code>hideLoading</code>&#x7528;&#x4E8E;&#x663E;&#x793A;&#x4E0E;&#x9690;&#x85CF;&#x52A0;&#x8F7D;&#x52A8;&#x753B;&#x7684;&#x64CD;&#x4F5C;&#x3002;</li>
<li>&#x63A5;&#x53E3;&#x65B9;&#x6CD5;<code>dispose</code>&#x9700;&#x5B9E;&#x73B0;&#x6307;&#x6807;&#x63D2;&#x4EF6;&#x7684;&#x91CA;&#x653E;&#x903B;&#x8F91;&#xFF0C;&#x56DE;&#x6536;&#x8D44;&#x6E90;&#x3002;</li>
<li>&#x63A5;&#x53E3;&#x65B9;&#x6CD5;<code>getElement</code>&#x9700;&#x8FD4;&#x56DE;&#x6307;&#x6807;&#x63D2;&#x4EF6;&#x7684;DOM&#x5BF9;&#x8C61;&#x3002;</li>
<li>&#x63A5;&#x53E3;&#x65B9;&#x6CD5;<code>getChart</code>&#x9700;&#x8FD4;&#x56DE;&#x6307;&#x6807;&#x63D2;&#x4EF6;&#x7684;&#x5B9E;&#x4F8B;&#x5BF9;&#x8C61;&#x3002;</li>
</ul>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="explain-intro.html" class="navigation navigation-prev " aria-label="Previous page: 指标开发讲解">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="explain-property1.html" class="navigation navigation-next " aria-label="Next page: 指标通用属性">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"指标核心逻辑","level":"1.3.1","depth":2,"next":{"title":"指标通用属性","level":"1.3.2","depth":2,"path":"explain-property1.md","ref":"explain-property1.md","articles":[]},"previous":{"title":"指标开发讲解","level":"1.3","depth":1,"path":"explain-intro.md","ref":"explain-intro.md","articles":[{"title":"指标核心逻辑","level":"1.3.1","depth":2,"path":"explain-bootstrap.md","ref":"explain-bootstrap.md","articles":[]},{"title":"指标通用属性","level":"1.3.2","depth":2,"path":"explain-property1.md","ref":"explain-property1.md","articles":[]},{"title":"指标自定义属性","level":"1.3.3","depth":2,"path":"explain-property2.md","ref":"explain-property2.md","articles":[]},{"title":"指标钻取事件","level":"1.3.4","depth":2,"path":"explain-event.md","ref":"explain-event.md","articles":[]}]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"explain-bootstrap.md","mtime":"2018-08-30T06:29:40.364Z","type":"markdown"},"gitbook":{"version":"3.0.0","time":"2018-08-30T06:38:59.990Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/buttons.js"></script>
        
    

    </body>
</html>

